package com.qf.listener;

import com.event.EventListener;
import com.qf.entity.Room;
import com.qf.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RoomEventListener implements EventListener<Room> {

    @Autowired
    private ISearchService searchService;

    @Override
    public String eventType() {
        return "room_insert";
    }

    @Override
    public void eventHandler(Room room) {
        System.out.println("搜索服务接收到同步客房的事件：" + room);
        searchService.insertRoom(room);
        searchService.insertRoomPirce(room.getHid(), room.getPrices());
    }
}
